#include <stdio.h>
#include <string.h>


int
main ()
{
	int howmany = 0;
	char in = 0;
	register int i = 0, st = 0;

	freopen("unpack.in", "r", stdin);
	freopen("unpack.out", "w", stdout);

	while ((in = getchar()) != EOF) {
		if (in >= '0' && in <= '9') {	
			howmany = howmany * 10 + (in - '0');
		} else if (in >= 'A' && in <= 'Z') {
			if (howmany > 0)
				--howmany;
			while (howmany >= 0) {
				printf("%c", in);
				if (++st % 40 == 0) {
					printf("\n");
				}
				--howmany;
			}
			howmany = 0;
		}
	}
	printf("\n");
	return 0;
}
